#ifndef SD__IMPLEMENTATION__SELF_DEBUG_H
#define SD__IMPLEMENTATION__SELF_DEBUG_H

#include "../../dwarf/LocationCursor.h"
#include "../SelfDebug.h"

#include <cstddef>

namespace sd {
namespace implementation {

class SelfDebug : public sd::SelfDebug {
private:
	friend class sd::SelfDebug;

private:
	static const char *getTabs(size_t _level);
private:
	SelfDebug();
	~SelfDebug();
public:
	bool loadDebugInfo(const char *_file) const;
public:
	bool infoLocals() const;
private:
	bool infoLocalsInLexicalBlock(Dwarf_Debug _debug, Dwarf_Die _die, const void *_framePc, const void *_frameAddress, bool *_finish = NULL) const;
	bool infoLocalsInInlinedSubroutine(Dwarf_Debug _debug, Dwarf_Die _die, const void *_framePc, const void *_frameAddress) const;
private:
	bool print(Dwarf_Debug _debug, Dwarf_Die _typeDie, dwarf::LocationCursor &_locationCursor, size_t _level) const;
private:
	bool printArgument(Dwarf_Debug _debug, Dwarf_Die _argument, const void *_frame, size_t _level) const;
	bool printLocal(Dwarf_Debug _debug, Dwarf_Die _local, const void *_frame, size_t _level) const;
	bool printInheritance(Dwarf_Debug _debug, Dwarf_Die _inheritance, const void *_object, size_t _level) const;
	bool printMember(Dwarf_Debug _debug, Dwarf_Die _member, const void *_object, size_t _level) const;
};

}
}

#endif // SD__IMPLEMENTATION__SELF_DEBUG_H
